/*
 * $Id: HiveMindModule.java 6 2008-02-03 23:14:51Z mlusetti $
 * --------------------------------------------------------------------------------------
 * Copyright (c) Massimo Lusetti <mlusetti@gmail.com>.  All rights reserved.
 *
 * The software in this package is published under the terms of the BSD style
 * license, a copy of which has been included with this distribution in the
 * LICENSE.txt file.
 */
package it.datacode.t5hivebridge;

import it.datacode.t5hivebridge.provider.HiveMindObjectProvider;
import org.apache.tapestry.ioc.ObjectProvider;
import org.apache.tapestry.ioc.OrderedConfiguration;
import org.apache.tapestry.ioc.annotations.InjectService;
import org.slf4j.Logger;

/**
 * HiveMind based {@link ObjectProvider} which will serve HiveMind
 * services through Tapestry5 IoC context.
 * 
 * @author Massimo Lusetti <mlusetti@gmail.com>
 *
 */
public class HiveMindModule
{
    /**
     * Contribute the {@link org.apache.tapestry.ioc.ObjectProvider} for HiveMind services to
     * the {@link org.apache.tapestry.ioc.services.MasterObjectProvider} T5 IoC service
     * 
     * @param configuration the configuration for the {@link org.apache.tapestry.ioc.services.MasterObjectProvider}
     * @param hivemind the actual {@link org.apache.tapestry.ioc.ObjectProvider} for HiveMind services
     */
    public static void contributeMasterObjectProvider(
            OrderedConfiguration<ObjectProvider> configuration,
            @InjectService("HiveMind")
            ObjectProvider hivemind)
    {
        configuration.add("hivemind", hivemind);
    }
    
    /**
     * Build the actual provider for HiveMind services
     * @param logger logging facility
     * @return the {@link ObjectProvider} delegated to lookup objects
     */
    public static ObjectProvider buildHiveMind(Logger logger)
    {
        return new HiveMindObjectProvider(logger);
    }

}
